package com.tencent.bk.sdk.iam.constants;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import org.apache.commons.lang3.StringUtils;

public enum AuthTypeEnum {
    NONE("none"),
    BASIC("basic"),
    DIGEST("digest"),
    SIGN("signature");

    @JsonValue
    private String name;

    @JsonCreator
    public static AuthTypeEnum parseType(String name) {
        if (StringUtils.isBlank(name)) {
            return null;
        } else {
            for (AuthTypeEnum typeEnum : values()) {
                if (typeEnum.getName().equals(name)) {
                    return typeEnum;
                }
            }
            return null;
        }
    }

    public String getName() {
        return this.name;
    }

    private AuthTypeEnum(String name) {
        this.name = name;
    }
}
